% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/varinfo.R
\name{varinfo}
\alias{varinfo}
\title{Get metadata about a variable, like its type, short name, long definition, decimal places, etc.}
\usage{
varinfo(
  var = map_headernames$rname,
  info = colnames(map_headernames),
  varnametype = "rname"
)
}
\arguments{
\item{var}{vector of variable names such as c("pctlowinc", "pm") or c(names_d, names_d_subgroups)
(and must be found in the column of map_headernames indicated by varnametype parameter below).}

\item{info}{types of metadata/info needed, such as "decimals", "long", etc.
which should be among colnames of map_headernames,
or alias like "long" as allowed by \code{\link[=fixcolnames]{fixcolnames()}}}

\item{varnametype}{optional. colname of map_headernames to use when looking for var,
like "rname" or "api" or "long"}
}
\value{
data.frame of 1 or more rows, 1 or more columns, where

rowsnames are var (indicators like "pctmin")

colnames are info (metadata   like "decimals")

Cells of table are metadata such as what type of indicator is that var, how many
decimal places of rounding should be displayed for it in tables, etc.

Results can be character, numeric, etc. depending on what info is requested
}
\description{
This is just a way to query map_headernames, which has info about each indicator or
variable used in EJAM.
}
\details{
See map_headernames for what kind of information is available there.
But if a variable appears twice+ in var or in map_headernames, info returned only for the 1st row of those.

Developers may wish to know about these functions,
several of which are not exported:
\itemize{
\item \code{\link[=varinfo]{varinfo()}}
\item \code{\link[=varname2varcategory_ejam]{varname2varcategory_ejam()}}
\item \code{\link[=varname2vartype_ejam]{varname2vartype_ejam()}}
\item \code{\link[=table_rounding_info]{table_rounding_info()}}
\item EJAM table_signif_round_x100()
\item \code{\link[=fixcolnames]{fixcolnames()}}
\item \code{\link[=fixcolnames_infer]{fixcolnames_infer()}}
\item EJAM fixcolnames2related()
\item EJAM fixmapheadernamescolname()
\item EJAM is.numericish()
\item EJAM varin_map_headernames()
\item EJAM namesbyvarlist()
\item EJAM names_whichlist()
\item EJAM names_whichlist_multi()
\item EJAM names_whichlist_multi_key()
\item EJAM formula_varname()
}

and the various related data objects like map_headernames and namez
}
\examples{
varinfo("traffic.score", "decimals")
varinfo(names_d, "long")
myvars <- c(names_d, names_d_subgroups, names_e)
myinfo <- "percentage"
cbind(  is.a.percentage = varinfo(myvars, myinfo) )
cbind(varinfo(names_all_r, "pctile."))
myinfo <- "long"
cbind(varinfo(myvars, myinfo) )
table_rounding_info(names_e)

varinfo(
 var = c(names_these, names_d_pctile),
 info = c(
 "topic_root_term", "varcategory", "vartype", "percentage", "pctile.", "calculation_type"
))

varinfo(names_all_r, c("varcategory", "varlist", "in_api", "in_bgcsv"))

cbind(
  namez$d, 
  names_d, 
  varinfo(names_d, "varlist"), 
  usavg = unlist(avg.in.us[names_d]), 
  usavg_varname = EJAM:::fixcolnames2related(names_d, "usavg"), 
  categ = varname2varcategory_ejam(names_d)
)

names(map_headernames)
t(varinfo(names_d[1]))

}
\seealso{
\code{\link[=fixcolnames]{fixcolnames()}} \code{\link[=table_rounding_info]{table_rounding_info()}}
}
\keyword{internal}
